from turtle import *
import random
# 生成全屏画布
setup(1.0,1.0)
# 设置背景色
bgcolor("pink")
# 隐藏小海龟
hideturtle() 
# 设置指针速度(1-10)
# speed(10)

# 生
penup()
goto(-250,-130)
right(135)
pendown()
width(20)
pencolor("blue")
forward(80)

penup()
left(135)
goto(-275,-165)
pendown()
forward(100)

penup()
goto(-300,-210)
pendown()
forward(130)

penup()
right(90)
goto(-220,-120)
pendown()
forward(150)

left(90)
penup()
goto(-300,-270)
pendown()
forward(130)

# 日
penup()
goto(-130,-125)
pencolor('red')
pendown()
forward(100)
right(90)
forward(150)
right(90)
forward(100)
right(90)
forward(150)
penup()
right(90)
goto(-130,-200)
pendown()
forward(100)


# 快
penup()
goto(30,-145)
right(90)
pencolor("purple")
pendown()
forward(50)
penup()
goto(60,-125)
pendown()
forward(150)
penup()
goto(90,-145)
pendown()
forward(50)
penup()
goto(120,-145)
left(90)
pendown()
forward(60)
right(90)
forward(50)
penup()
left(90)
goto(120,-205)
pendown()
forward(80)
penup()
right(90)
goto(145,-125)
pendown()
forward(80)
right(15)
forward(70)
left(50)
penup()
goto(145,-200)
pendown()
forward(70)


# 乐
penup()
right(35)
right(45)
goto(290,-110)
pencolor("yellow")
pendown()
forward(70)
left(45)
forward(40)
left(90)
forward(100)
right(90)
penup()
goto(290,-140)
pendown()
forward(130)
right(90)
right(45)
forward(30)
penup()
left(90)
goto(250,-225)
pendown()
forward(20)
penup()
left(90)
goto(320,-225)
pendown()
forward(20)


# 蛋糕
width(8)
penup()
goto(-220,-80)
left(45)
pendown()
forward(450)

penup()
goto(-200,-60)
pencolor("red")
pendown()
forward(410)

penup()
goto(-180,-40)
pencolor("light blue")
pendown()
forward(370)

penup()
goto(-160,-30)
width(2)
begin_fill()
color("deep pink","deep pink")
pendown()
forward(330)
left(90)
forward(30)
left(90)
forward(330)
left(90)
forward(30)
left(90)
forward(330)
end_fill()

penup()
goto(-160,5)
begin_fill()
color("light green","light green")
pendown()
forward(330)
left(90)
forward(30)
left(90)
forward(330)
left(90)
forward(30)
left(90)
forward(330)
end_fill()

penup()
goto(-160,40)
begin_fill()
color("yellow","yellow")
pendown()
forward(330)
left(90)
forward(30)
left(90)
forward(330)
left(90)
forward(30)
left(90)
forward(330)
end_fill()

penup()
goto(-160,75)
begin_fill()
color("white","white")
pendown()
forward(330)
left(90)
forward(30)
left(90)
forward(330)
left(90)
forward(30)
left(90)
forward(330)
end_fill()

penup()
goto(-130,105)
left(90)
pencolor("blue")
pendown()
forward(50)


penup()
goto(-70,105)
pencolor("brown")
pendown()
forward(50)



penup()
goto(-10,105)
pencolor("red")
pendown()
forward(50)

penup()
goto(50,105)
pencolor("deep pink")
pendown()
forward(50)

penup()
goto(110,105)
pencolor("green")
pendown()
forward(50)

# 星星
def star(color,x,y):
    penup()
    goto(x,y)
    pencolor(color)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
    penup()
    goto(x,y)
    right(45)
    pendown()
    forward(10)
# 随机生成星星
speed(1000)
for i in range(15):
    x=random.randint(-330,330)
    y=random.randint(180,280)
    color=random.choice(['deep pink','blue','brown','red'])
    star(color,x,y)
# 写字
penup()
pencolor("deep pink")
goto(300,-50)
write('永远幸福',font=("楷体",50))

goto(-700,100)
write('老妈 生日快乐',font=("楷体",50))
done()